package com.ruoyi.web.controller.room;

import com.cdtu.room.service.IReportService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * 统计报表Controller
 *
 * @author hcc
 * @date 2024-02-27
 */
@RestController
@RequestMapping("/room/report")
public class ReportController extends BaseController {
    @Autowired
    private IReportService reportService;
    /**
     * 预约人数统计报表
     * @param begin
     * @param end
     * @return
     */
    @PreAuthorize("@ss.hasPermi('room:report:query')")
    @GetMapping(value = "/getReservationReport")
    public AjaxResult getReservationReport(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
        return success(reportService.getReservationReport(begin,end));
    }
    /**
     * 用户数据统计报表
     * @param begin
     * @param end
     * @return
     */
    @PreAuthorize("@ss.hasPermi('room:report:query')")
    @GetMapping(value = "/getUserReport")
    public AjaxResult getUserReport(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
        return success(reportService.getUserReport(begin,end));
    }
}
